import Vuex from 'vuex'
var flag:boolean = true
interface State {
  token:string,
  isUniqueOpened:boolean
}
const store = new Vuex.Store({
  state: {
    token:"ey-ffxf3244t411fg-1222d1sec1e",
    isUniqueOpened:true, //是否只保持一个子菜单的展开
    isCollapse:false,//是否水平折叠收起菜单（仅在 mode 为 vertical 时可用）
  },
  mutations: {
    getToken (state,data:string) {
      state.token = data
    },
    // 左侧菜单展开或者收起的方法
    changeCollapse (state) {
      state.isCollapse = !state.isCollapse
    }
  },
  actions: {
    changeToken ({commit}) {
      // return new Promise((resolve,reject) => {
      // })
      if (flag) {
        commit('getToken',10086)
      }else{
        commit('getToken',10085)
      }
      flag = !flag
    }
  },
  modules: {
  }
})
export default store